Repository navigation
Conversation
…ssages `utils.py` in cartesia-sdk-python and pipecat-sdk-python are copies of the same file. supermemoryai#1434 hardened two spots in the pipecat copy and missed cartesia. `unique_search` calls `_field(r, ...)` on every search result. For a plain string that finds no attribute, falls back to `""`, and the entry is dropped before it reaches the prompt. `format_memories_to_text` in the same file has an `isinstance(item, str)` branch for search results, so that branch is currently unreachable. `get_last_user_message` indexed `msg["role"]` and `msg["content"]` positionally, so a tool-call turn or provider event missing either key raised KeyError instead of being skipped, and non-string content was returned verbatim despite the `str | None` annotation. Both hunks now match the pipecat implementation.
|
Two things a reviewer would reasonably want to know, both checked: Do the other SDKs have the same two bugs? No. Is the rest of the file in sync with pipecat now? Yes. The two One thing that audit did turn up, which is not fixed here: both voice SDKs diverge from the TypeScript |
|
🤖 AI-assisted triage, reviewed by @MaheshtheDev. Thank you for this fix! It's now included in #1799, which bundles the community fixes for the Python wrappers (openai, cartesia, pipecat). Your commit is kept with you as the author, and you're credited as a co-author on the merge. Closing in favor of #1799. |
…ppers (#1799) Bundles 10 community fixes for the Python wrappers, each commit kept with its original author. Ships supermemory-openai-sdk 1.0.10, supermemory-cartesia 0.1.5 and supermemory-pipecat 0.1.5. - openai-sdk-python: shared OpenAI clients no longer leak memories across tenants (#1503), memory search fails open instead of crashing the chat (#1288), the requests fallback runs off the event loop (#1660), get_profile works for users with no memories (#1759). - cartesia: the wrapped agent runs exactly once per event (#1280, #1670), plain-string and chunk-only search results are kept (#1683, #1693). - pipecat: memory text stays literal when replacing the injected block (#1647), `InputParams` is exported from the package root (#1575). - #1503 was hand-ported onto main's newer middleware. #1751 is left out: the v5 agent-framework migration (#1786) appends to the conversation document by design. Co-Authored-By: abhinav7x94 <204053250+abhinav7x94@users.noreply.github.com> Co-Authored-By: shamAnimates <145093437+shamAnimates@users.noreply.github.com> Co-Authored-By: aloktripathi1 <142301030+aloktripathi1@users.noreply.github.com> Co-Authored-By: Cintu07 <178455858+Cintu07@users.noreply.github.com> Co-Authored-By: Atharvsinh-codez <201381760+Atharvsinh-codez@users.noreply.github.com> Co-Authored-By: abhay-codes07 <182421137+abhay-codes07@users.noreply.github.com> Co-Authored-By: nkootstra <545768+nkootstra@users.noreply.github.com> Co-Authored-By: Agnik47 <140933190+Agnik47@users.noreply.github.com>
Summary
src/supermemory_cartesia/utils.pyandsrc/supermemory_pipecat/utils.pyare copies of the same file. #1434 hardened two spots in the pipecat copy and missed the cartesia one. This brings the two hunks back to parity and adds regression tests.Bug 1 — plain-string search results are silently dropped
deduplicate_memories→unique_searchcalls_field(r, "memory", "chunk", "content", default="")on every result. For a plainstrthat finds no attribute, falls back to"", and the entry never reaches the prompt.format_memories_to_textin the same file already has anisinstance(item, str)branch for search results, so that branch is currently unreachable — nothing can get past dedup as a string.Reproduced against the pipecat copy as the reference:
Bug 2 —
get_last_user_messageraisesKeyErrorIt indexed
msg["role"]andmsg["content"]positionally, so a tool-call turn or provider event missing either key raised instead of being skipped. Non-string content was also returned verbatim despite the-> str | Noneannotation.Changes
src/supermemory_cartesia/utils.py— both hunks now match the pipecat implementation exactly.tests/test_utils.py— new, 6 tests.Test plan
mainand pass with the fix:8 passed.ci-python.ymlalready path-filterspackages/cartesia-sdk-python/**, so these run in CI with no workflow change.No behaviour change for dict or Stainless-model search results — covered by
test_still_reads_the_memory_field_of_models_and_dicts.